package com.macro.mall.tiny.modules.foster.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.macro.mall.tiny.modules.foster.model.AlipayOrder;
import com.macro.mall.tiny.modules.foster.model.Appointment;
import com.macro.mall.tiny.modules.foster.model.Pet;
import com.macro.mall.tiny.modules.foster.model.Room;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhuyi
 * @since 2024-04-03
 */
public interface AppointmentMapper extends BaseMapper<Appointment> {

    @Select("select start_time,end_time from appointment where pet_id = #{id};")
    Map<String, Date> selectDate(Long id);

    @Select("select room_id from appointment where pet_id = #{id};")
    Long selectRoomId(Long id);

    @Select("select * from appointment where pet_id = #{id};")
    Appointment selectByPetId(long petId);

    @Select("select * from room where id = #{roomId};")
    Room selectRoomByRoomId(Long roomId);

    @Select("select * from pet where id = #{petId};")
    Pet selectPetByPetId(Long petId);

    @Select("select * from alipay_order where trade_no = #{tradeNo}")
    List<AlipayOrder> selectOrder(Long tradeNo);

    @Select("select trade_status from alipay_order where id = #{id};")
    int selectOrderStatus(Long id);
}
